<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="description" content="Partytown Test Page" />
    <title>Element Class</title>
    <style>
      body {
        font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif,
          Apple Color Emoji, Segoe UI Emoji;
        font-size: 12px;
      }
      h1 {
        margin: 0 0 15px 0;
      }
      ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
      }
      a {
        display: block;
        padding: 16px 8px;
      }
      a:link,
      a:visited {
        text-decoration: none;
        color: blue;
      }
      a:hover {
        background-color: #eee;
      }
      li {
        display: flex;
        margin: 15px 0;
      }
      li strong,
      li code,
      li button {
        white-space: nowrap;
        flex: 1;
        margin: 0 5px;
      }
    </style>
    <script>
      partytown = {
        logCalls: true,
        logGetters: true,
        logSetters: true,
        logStackTraces: false,
        logScriptExecution: true,
        logMainAccess: true,
      };
    </script>
    <script src="/~partytown/debug/partytown.js"></script>
  </head>
  <body>
    <h1>Element Class</h1>
    <ul>
      <li>
        <strong>className set/get</strong>
        <code id="testClassname"></code>
        <script type="text/partytown">
          (function() {
            const elm = document.getElementById('testClassname');
            elm.className = 'testClassname';
            elm.textContent = elm.className;
          })();
        </script>
      </li>

      <li>
        <strong>classList.add()</strong>
        <code id="testClassList"></code>
        <script type="text/partytown">
          (function() {
            const elm = document.getElementById('testClassList');
            const classList = elm.classList;
            classList.add('testClassList');
            elm.textContent = elm.className;
          })();
        </script>
      </li>

      <li>
        <strong>classList.remove()</strong>
        <code id="testClassListRemove" class="remove-me testClassListRemove"></code>
        <script type="text/partytown">
          (function() {
            const elm = document.getElementById('testClassListRemove');
            elm.classList.remove('remove-me');
            elm.textContent = elm.className;
          })();
        </script>
      </li>

      <li>
        <strong>classList.toggle() on</strong>
        <code id="testToggleOn"></code>
        <script type="text/partytown">
          (function() {
            const elm = document.getElementById('testToggleOn');
            elm.classList.toggle('testToggleOn');
            elm.textContent = elm.className;
          })();
        </script>
      </li>

      <li>
        <strong>classList.toggle() off</strong>
        <code id="testToggleOff" class="remove-me testToggleOff"></code>
        <script type="text/partytown">
          (function() {
            const elm = document.getElementById('testToggleOff');
            elm.classList.toggle('remove-me');
            elm.textContent = elm.className;
          })();
        </script>
      </li>

      <li>
        <strong>classList.value</strong>
        <code id="testClassListValue" class="testClassListValue"></code>
        <script type="text/partytown">
          (function() {
            const elm = document.getElementById('testClassListValue');
            elm.textContent = elm.classList.value;
          })();
        </script>
      </li>

      <li>
        <strong>classList.length</strong>
        <code id="testClassListLength" class="a b c"></code>
        <script type="text/partytown">
          (function() {
            const elm = document.getElementById('testClassListLength');
            elm.textContent = elm.classList.length;
          })();
        </script>
      </li>

      <li>
        <strong>immediate classList.add()</strong>
        <code id="testImmediateLabel"></code>
        <script type="text/partytown">
          (function () {
            const elm = document.getElementById('testImmediateLabel');
            const span = document.createElement('span');
            span.innerText = 'add';
            span.classList.add('testImmediate1');
            span.classList.add('testImmediate2');
            span.id = 'testImmediate';
            elm.appendChild(span);
          })();
        </script>
      </li>

      <script type="text/partytown">
        document.body.classList.add('completed');
      </script>
    </ul>

    <hr />
    <p><a href="/tests/">All Tests</a></p>
  </body>
</html>
